// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import axios from 'axios'
import 'styles/border.css'
import 'styles/reset.css'
import 'styles/overall.css'
import 'js/mobile-util.js'
import 'styles/iconfont.css'
import VueJsonp from 'vue-jsonp'
import qs from 'qs'
import tool from './assets/js/tool.js'
Vue.prototype.tool = tool
Vue.prototype.$axios = axios
Vue.prototype.$qs = qs

Vue.prototype.$axios.interceptors.request.use((config) => {
  config.headers['X-Requested-With'] = 'XMLHttpRequest'
  let regex = /.*csrftoken=([^;.]*).*$/ // 用于从cookie中匹配 csrftoken值
  config.headers['X-CSRFToken'] = document.cookie.match(regex) === null ? null : document.cookie.match(regex)[1]
  return config
})

Vue.use(VueJsonp)
Vue.config.productionTip = false
Vue.use(VueAwesomeSwiper)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
